package com.rc.saas.tenant.service.ugs;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.base.BaseSearch;
import com.rc.saas.tenant.mapper.ugs.UgsMemberLevelRecordMapper;
import com.rc.saas.tenant.vo.ugs.UgsMemberLevelRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author frog
 * @date 2021/4/8
 */
@Service
public class UgsMemberLevelRecordServiceImpl implements UgsMemberLevelRecordService {

    @Autowired
    private UgsMemberLevelRecordMapper ugsMemberLevelRecordMapper;

    @Override
    public UgsMemberLevelRecordMapper getMapper() {
        return ugsMemberLevelRecordMapper;
    }

    @Override
    public PageInfo<UgsMemberLevelRecordVo> listPageMemberLevelRecord(BaseSearch baseParam, Long memberId) {
        PageHelper.startPage(baseParam.getOffset(), baseParam.getLimit());
        //UgsMemberLevelRecordExample example = new UgsMemberLevelRecordExample();
        //example.createCriteria().andMemberIdEqualTo(memberId);
        //example.setOrderByClause("created_time DESC");
        // List<UgsMemberLevelRecord> ugsMemberLevelRecords = ugsMemberLevelRecordMapper.selectByExample(example);
        List<UgsMemberLevelRecordVo> ugsMemberLevelRecords = ugsMemberLevelRecordMapper.listPageMemberLevelRecord(baseParam.getTenantCode(), memberId);
        return new PageInfo<UgsMemberLevelRecordVo>(ugsMemberLevelRecords);
    }
}
